package avicit.bdp.dgs.standard.rest;

import avicit.bdp.core.enums.DataStateEnum;
import avicit.bdp.core.enums.DataElementDataTypeEnum;
import avicit.bdp.core.enums.DataElementStandardTypeEnum;
import avicit.platform6.core.rest.msg.ResponseMsg;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.HashMap;
import java.util.Map;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author mayi
 * 数据标准枚举值
 */
@RestController
@RequestMapping("/api/bdp/dgs/dataStandard/enums/")
@Api(tags = "数据标准枚举值")
public class StandardEnumRest {

	@ApiOperation(value = "数据状态枚举")
	@GetMapping("/status")
	public ResponseMsg<Map<Integer, String>> status() {
		ResponseMsg<Map<Integer, String>> responseMsg = new ResponseMsg<>();
		Map<Integer, String> resultMap = new HashMap<>(16);
		DataStateEnum[] values = DataStateEnum.values();
		for (DataStateEnum value : values) {
			resultMap.put(value.getCode(), value.getDesc());
		}
		responseMsg.setResponseBody(resultMap);
		return responseMsg;
	}


	@ApiOperation(value = "标准类型枚举")
	@GetMapping("/standardType")
	public ResponseMsg<Map<Integer, String>> standardType() {
		ResponseMsg<Map<Integer, String>> responseMsg = new ResponseMsg<>();
		Map<Integer, String> resultMap = new HashMap<>(16);
		DataElementStandardTypeEnum[] values = DataElementStandardTypeEnum.values();
		for (DataElementStandardTypeEnum value : values) {
			resultMap.put(value.getCode(), value.getDescription());
		}
		responseMsg.setResponseBody(resultMap);
		return responseMsg;
	}


	@ApiOperation(value = "数据元数据类型枚举")
	@GetMapping("/dataType")
	public ResponseMsg<Map<Integer, String>> dataType() {
		ResponseMsg<Map<Integer, String>> responseMsg = new ResponseMsg<>();
		Map<Integer, String> resultMap = new HashMap<>(16);
		DataElementDataTypeEnum[] values = DataElementDataTypeEnum.values();
		for (DataElementDataTypeEnum value : values) {
			resultMap.put(value.getCode(), value.getChineseDescription());
		}
		responseMsg.setResponseBody(resultMap);
		return responseMsg;
	}
}
